<template>
  <div style="width: 100% height:100%; background-color:#f5f5f5;">
    <el-backtop></el-backtop>
    <!-- header -->
    <el-row>
      <el-col :span="24">
        <div>
          <div style="background-color: #333; height: 40px; width: 100%">
              <div style="float: right; margin: 10px">
                
                <el-link @click="myself" type="info">{{this.user.username}}</el-link>
                <el-link @click="logont" style="margin-left: 20px" type="info"
                  >退出</el-link
                >
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
    <!-- meader -->
    <el-row>
      <el-col :span="24">
        <div>
          <div style="background-color: white; height: 88px; width: 100%">
            <el-row>
              <el-col :span="5">
                <div
                  style="margin: 0; padding: 0; border-bottom: 1px solid #ccc"
                >
                  <h1
                    style="
                      text-align: center;
                      font-family: Helvetica Neue;
                      color: #ff6700;
                    "
                  >
                    易聘-校园招聘
                  </h1>
                </div>
              </el-col>
              <el-col :span="13">
                <el-menu
                  mode="horizontal"
                  text-color="#333"
                  active-text-color="#ff6700"
                  router
                  :default-active="activeIndex"
                  
                >
                  <el-menu-item index="/main">首页</el-menu-item>
                  <el-menu-item index="/userRecruit">招聘信息</el-menu-item>
                  <el-menu-item index="/Company">企业信息</el-menu-item>
                  <el-menu-item index="/myself">个人中心</el-menu-item>
                </el-menu>
              </el-col>
              <el-col :span="6">
                <div
                  style="
                    background-color: white;
                    height: 100%;
                    width: 100%;
                    border-bottom: 1px solid #ccc;
                  "
                />
              </el-col>
            </el-row>
          </div>
        </div>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24">
        <router-view />
      </el-col>
    </el-row>
    <!-- footer -->
    <el-row>
      <el-col :span="24">
        <div>
          <div
            style="
              background-color: white;
              height: 50px;
              width: 100%;
              border-top: 1px solid #ccc;
            "
          >
            <p style="text-align: center; font-size: 10px; color: darkgray">
              @2022 易聘 by Ginger
            </p>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  data() {
    return {
      activeIndex:'/main',
      userId: '',
      username: '',
      user:{},
      yonghu:{},
    }
  },
  created() {
    this.getYonghu()
  },
  methods: {
    async getYonghu(){
      this.user=JSON.parse(window.sessionStorage.getItem('user'))
      const {data:res}=await this.$http.get('userByUsername?username='+this.user.username)
      if(res.meta.status!=200) return this.$message.error(res.meta.msg)
      this.yonghu=res.data

    },
    myself(){
      this.$router.push('/myself')

    },
    logont() {
      window.sessionStorage.clear()
      this.$router.push('/login')
    },
    
  },
}
</script>

<style>
.el-menu {
  height: 85px;
}
</style>
